<!DOCTYPE html>
<html>

<head>
    <title>Example</title>

</head>

<body>
    <script type="text/javascript">
        // 获取文档信息，Document元数据
        document.writeln("<pre>");

        document.writeln("protocol: " + document.location.protocol);
        document.writeln("host: " + document.location.host);
        document.writeln("hostname: " + document.location.hostname);
        document.writeln("port: " + document.location.port);
        document.writeln("pathname: " + document.location.pathname);
        document.writeln("search: " + document.location.search);
        document.writeln("hash: " + document.location.hash);

        document.writeln("</pre>");
    </script>
</body>

</html>